package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据套餐id查询
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> findBySetmealId(Long id);

    /**
     * 新增套餐菜品
     * @param setmealDish
     */
    void add(SetmealDish setmealDish);

    /**
     * 根据套餐id删除
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    void delete(Long id);

    /**
     * 根据菜品id查询
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where dish_id=#{id}")
    SetmealDish findByDishId(Long id);
}
